﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using BusinessLogic.Interfaces;
using Domain;
using Domain.Entities;

namespace BusinessLogic.Implementations
{
    public class EFDishesRepository : IDishesRepository
    {
        // реализация интерфейса
        private DomainContext context;
        public EFDishesRepository(DomainContext context)
        {
            this.context = context;
        }

        public IEnumerable<Dish> GetDishesAll()
        {
            return context.Dishes;
        }

        public IEnumerable<Dish> GetList(Expression<Func<Dish, bool>> filter)
        {
            return context.Dishes.Where(filter);
        }
        public IEnumerable<Dish> GetDishes(int id)
        {
            return context.Dishes.Where(x =>x.MenuID==id);
        }
    }
}